package com.pengzy.comment.core.enums;

import lombok.Getter;

/**
 * 基本模块错误码
 * @author xiaozhi 2023/7/12
 */

public enum PrErrorEnum {

    ERROR_1001(1001,"用户或者密码错误！"),
    ERROR_1002(1002,"用户未登录或已过期！"),
    ERROR_1003(1003,"token非法！"),
    ERROR_1004(1004,"token错误！"),
    ERROR_1005(1005,"未找到此账户信息！"),
    ;
    @Getter
    private Integer code;
    @Getter
    private String info;

    PrErrorEnum(Integer code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public static PrErrorEnum getObj(String code){
        for (PrErrorEnum type : values()) {
            if ( type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
